package com.csc.banking.model;

// Generated Jul 11, 2014 10:43:16 PM by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Transactions generated by hbm2java
 */
@Entity
@Table(name = "Transactions", catalog = "mydb")
public class Transaction implements EntityObject, java.io.Serializable
{

	private Long transactionId;
	private Customer customer;
	private Date beginTime;
	private Date endTime;
	private Set<TransactionAction> transactionActions = new HashSet<TransactionAction>(0);
	private static final long serialVersionUID = 1L;

	public Transaction()
	{
	}

	public Transaction(Customer customer, Date beginTime, Date endTime)
	{
		this.customer = customer;
		this.beginTime = beginTime;
		this.endTime = endTime;
	}

	public Transaction(Customer customer, Date beginTime, Date endTime,
			Set<TransactionAction> transactionActions) 
	{
		this.customer = customer;
		this.beginTime = beginTime;
		this.endTime = endTime;
		this.transactionActions = transactionActions;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "TransactionId", unique = true, nullable = false)
	public Long getTransactionId()
	{
		return this.transactionId;
	}

	public void setTransactionId(Long transactionId)
	{
		this.transactionId = transactionId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CustomerId", nullable = false)
	public Customer getCustomer() 
	{
		return this.customer;
	}

	public void setCustomer(Customer customer) 
	{
		this.customer = customer;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "BeginTime", nullable = false, length = 19)
	public Date getBeginTime() 
	{
		return this.beginTime;
	}

	public void setBeginTime(Date beginTime) 
	{
		this.beginTime = beginTime;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "EndTime", nullable = false, length = 19)
	public Date getEndTime() 
	{
		return this.endTime;
	}

	public void setEndTime(Date endTime) 
	{
		this.endTime = endTime;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "transaction")
	public Set<TransactionAction> getTransactionActions() 
	{
		return this.transactionActions;
	}

	public void setTransactionActions(
			Set<TransactionAction> transactionActions) 
	{
		this.transactionActions = transactionActions;
	}

}
